<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-6">
        <h2>分类管理</h2>
        <ol class="breadcrumb">
            <li class="active">
                 <strong><a href="index.html">主页</a></strong>
            </li>
            <li>
                <a>分类管理</a>
            </li>
        </ol>
    </div>
    <div class="col-lg-6">
        <h2><a href="{:U('admin/catalog/add')}" class="btn btn-success btn-lg pull-right">添加分类</a></h2>
    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
         <div class="ibox-content">
                <table class="table  table-hover">
                   
                    <tbody>
                        <tr class="level1">
                            <th width="80px">id</th>
                            <th width="200px">分类</th>
                            <th width="80px">操作</th>
                        </tr>
                        <volist name="level1" id="c" >
                        <tr>
                            <td>{$c.id}</td>
                            <td>{$c.name}</td>
                            <td><a class="btn btn-primary btn-xs" href="{:U('admin/catalog/edit/id/'.$c['id'])}">编辑</a><a href="" class="btn btn-danger btn-xs">删除</a></td>
                        </tr>
                            <?php  $level2=M('prodect_catalog')->where('parent_id='.$c['id'])->select();?>
                            <volist name="level2" id="c2" >
                            <tr class="level2" id="level{$c2.id}">
                                <td>{$c2.id}</td>
                                <td>└───{$c2.name}</td>
                                <td><a class="btn btn-primary btn-xs" href="{:U('admin/catalog/edit/id/'.$c2['id'])}">编辑</a><a href="" class="btn btn-danger btn-xs">删除</a></td>
                            </tr>
                                <?php  $level3=M('prodect_catalog')->where('parent_id='.$c2['id'])->select();?>
                                <volist name="level3" id="c3" >
                                <tr class="level3 parent_level{$c2.id}">
                                    <td>{$c3.id}</td>
                                    <td>└───┴───{$c3.name}</td>
                                    <td><a class="btn btn-primary btn-xs" href="{:U('admin/catalog/edit/id/'.$c3['id'])}">编辑</a><a href="" class="btn btn-danger btn-xs">删除</a></td>
                                </tr>
                                </volist>
                            </volist>        
                        </volist>
                    </tbody>
                </table>
                
        </div>
    </div>
</div>
<style type="text/css">
    .level1{
        background: #ccc;
    }
    .level3{
        display: none;
    }
    .level2{
        cursor: pointer;
        background: #eee;
    }
</style>
<script type="text/javascript">
    $('.level2 td').click(function(){
        var id=$(this).parents('tr').attr('id');
        var l3='.parent_'+id;
        $(l3).toggle('slow');
    })
</script>
    